using System;

namespace PingPong.Generic
{

	public class ValueChangeEventArgs<T> : EventArgs
	{
		#region Members

		/// <summary>
		/// The previous.
		/// </summary>
		private Lazy<T> previous;
		/// <summary>
		/// The new.
		/// </summary>
		private Lazy<T> @new;

		#endregion

		#region Properties

		/// <summary>
		/// Gets the previous.
		/// </summary>
		/// <value>The previous.</value>
		public T Previous
		{
			get
			{
				return this.previous.Value;
			}
		}

		/// <summary>
		/// Gets the new.
		/// </summary>
		/// <value>The new.</value>
		public T New
		{
			get
			{
				return this.@new.Value;
			}
		}

		#endregion

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="PingPong.Generic.ValueChangedEventArgs`1"/> class.
		/// </summary>
		private ValueChangeEventArgs()
		{
			//No defaults.
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="PingPong.Generic.ValueChangedEventArgs`1"/> class.
		/// </summary>
		/// <param name="previousValue">Previous value.</param>
		/// <param name="newValue">New value.</param>
		public ValueChangeEventArgs(T previousValue, T newValue)
		{
			this.previous = new Lazy<T>(() => previousValue);
			this.@new = new Lazy<T>(() => newValue);
		}

		#endregion
	}
}

